package helpers;

public class DateConverter {

	public static String[] getTimeAndPerson(String[] erik, String[] johan) {
		String[] timeAndPerson = new String[erik.length + johan.length];
		int index = 0;
		if (erik.length > 0) {
			for (int i = 0; i < erik.length; i++) {
				timeAndPerson[index] = new String("Erik - "
						+ erik[i].substring(erik[i].indexOf(':') - 2,
								erik[i].indexOf(':') + 3));
				index++;
			}
		}
		if (johan.length > 0) {
			for (int i = 0; i < johan.length; i++) {
				timeAndPerson[index] = new String("Johan - "
						+ johan[i].substring(johan[i].indexOf(':') - 2,
								johan[i].indexOf(':') + 3));
				index++;
			}
		}

		return timeAndPerson;
	}

	public static String getDate(int year, int month, int day) {
		String date = "" + year + "-";
		month++;
		if (month < 10) {
			date = date + "0" + month + "-";
		} else {
			date = date + month + "-";
		}
		if (day < 10) {
			date = date + "0" + day;
		} else {
			date = date + day;
		}
		return date;
	}
}
